if offset(".",num)<>0 or offset("-",num)<>0 then put "Only Positive Integers are allowed" into ms
if ms is not empty then
play "boing"
put ms into message box
wait 80
hide message box
set cursor to 1
exit mouseup
end if
put trunc(ln(it)/ln(2)) into power
put empty into bin
put power into x
put 0 into p
repeat while x>=0
if p+(2^x)<=num then
add 2^x to p
put bin&"1" into bin
else
put bin&"0" into bin
end if
subtract 1 from x
end repeat
if num=0 then put "0" into bin
if length(bin)>17 then
put bin into message box
put "#################" into bin
end if
put bin into card field 6
---
put trunc(ln(num)/ln(16)) into power
-- put num&&power into the message box
put power into x
put empty into hx
put 0 into p
repeat while x>=0
put trunc((num-p)/(16^x)) into mul
if p+(mul*(16^x)) <=num then
add (mul*(16^x)) to p
put mul into hxc
if hxc=10 then put "A" into hxc
if hxc=11 then put "B" into hxc
if hxc=12 then put "C" into hxc
if hxc=13 then put "D" into hxc
if hxc=14 then put "E" into hxc
if hxc=15 then put "F" into hxc
put hx&hxc into hx
else
end if
subtract 1 from x
end repeat
put hx into card field 7
set cursor to 1
end mouseUp
-- part 10 (button)
-- low flags: 00
-- high flags: A002
-- rect: left=335 top=136 right=151 bottom=478
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Binary
----- HyperTalk script -----
on mouseUp
ask "Enter number in Binary form"
put it into bin
set cursor to 4
hide message box
if length(bin)>17 then
put bin into message box
put "#################" into card field 6
else
put bin into card field 6
end if
put empty into ms
put length(bin) into len
repeat with c=1 to len
if char c of bin <>"0" and char c of bin<>"1" then put "Use only 0's or 1's" into ms
if ms is not empty then
play "boing"
put ms into message box
wait 80
hide message box
put cursor into 1
exit mouseup
end if
end repeat
put 0 into num
put len into x
repeat while x>-1
add (char (len-x) of bin * 2^x) to num
subtract 1 from x
end repeat
put num into card field 5
--
put trunc(ln(num)/ln(16)) into power
put power into x
put empty into hx
put 0 into p
repeat while x>=0
put trunc((num-p)/(16^x)) into mul
if p+(mul*(16^x)) <=num then
add (mul*(16^x)) to p
put mul into hxc
if hxc=10 then put "A" into hxc
if hxc=11 then put "B" into hxc
if hxc=12 then put "C" into hxc
if hxc=13 then put "D" into hxc
if hxc=14 then put "E" into hxc
if hxc=15 then put "F" into hxc
put hx&hxc into hx
else
end if
subtract 1 from x
end repeat
put hx into card field 7
set cursor to 1
end mouseUp
-- part 11 (button)
-- low flags: 00
-- high flags: A002
-- rect: left=335 top=167 right=182 bottom=478
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Hexadecimal
----- HyperTalk script -----
on mouseUp
ask "Enter number in Hexadecimal form"
put it into bin
set cursor to 4
hide message box
put bin into card field 7
put empty into ms
put 0 into f
put length(bin) into len
repeat with c=1 to len
if chartonum(char c of bin) <48 then put 1 into f
if chartonum(char c of bin)>57 then
if chartonum(char c of bin)<65 then put 1 into f
if chartonum(char c of bin)>70 then
if chartonum(char c of bin)<97 and chartonum(char c of bin)>102 then put 1 into f
end if
end if
if f=1 then
play "boing"
put "This number is not a Hexadecimal number" into message box
wait 80
hide message box
set cursor to 1
exit mouseup
end if
end repeat
put 0 into num
put 0 into x
repeat while x<=len
put char (len-x) of bin into hx
if hx="a" or hx="A" then put 10 into hx
if hx="b" or hx="B" then put 11 into hx
if hx="c" or hx="C" then put 12 into hx
if hx="d" or hx="D" then put 13 into hx
if hx="e" or hx="E" then put 14 into hx
if hx="f" or hx="F" then put 15 into hx
add hx*16^x to num
add 1 to x
end repeat
put num into card field 5
--
put trunc(ln(num)/ln(2)) into power
put empty into bin
put power into x
put 0 into p
repeat while x>=0
if p+(2^x)<=num then
add 2^x to p
put bin&"1" into bin
else
put bin&"0" into bin
end if
subtract 1 from x
end repeat
if num=0 then put "0" into bin
if length(bin)>17 then
put bin into message box
put "#################" into bin
end if
put bin into card field 6
set cursor to 1
end mouseUp
-- part 12 (field)
-- low flags: 01
-- high flags: 0002
-- rect: left=335 top=118 right=133 bottom=478
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name:
-- part 13 (field)
-- low flags: 01
-- high flags: 0002
-- rect: left=335 top=149 right=164 bottom=478
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name:
-- part 14 (field)
-- low flags: 01
-- high flags: 0002
-- rect: left=335 top=181 right=196 bottom=478
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name:
-- part 15 (button)
-- low flags: 00
-- high flags: A002
-- rect: left=20 top=244 right=263 bottom=135
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Inches^4
----- HyperTalk script -----
on mouseUp
ask "Enter Value"
put it into card field 8
put it*2.54^4 into card field 9
end mouseUp
-- part 16 (button)
-- low flags: 00
-- high flags: A002
-- rect: left=20 top=290 right=309 bottom=135
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Centimeters^4
----- HyperTalk script -----
on mouseUp
ask "Enter Value"
put it into card field 9
put it/(2.54^4) into card field 8
end mouseUp
-- part 17 (field)
-- low flags: 01
-- high flags: 0002
-- rect: left=20 top=262 right=279 bottom=135
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name:
-- part 18 (field)
-- low flags: 01
-- high flags: 0002
-- rect: left=20 top=308 right=325 bottom=135
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name:
-- part contents for card part 3
----- text -----
9.879013
-- part contents for card part 4
----- text -----
4.2
-- part contents for card part 7
----- text -----
57.29578
-- part contents for card part 8
----- text -----
1.00
-- part contents for card part 12
----- text -----
24
-- part contents for card part 13
----- text -----
11000
-- part contents for card part 14
----- text -----
18
-- part contents for card part 17
----- text -----
0.240251
-- part contents for card part 18
----- text -----
10
-- part contents for background part 5
----- text -----
1 --,fuel,fuel consumption,consumption,mpg,m/g,miles per gallon,mile per gallon,mile/gallon,miles/gallon,miles per gal,mile per gal,mile/gal,miles/gal,mi per gallon,mi/gallon,mi per gal,mi/gal,mil/gal,m/gal,mi/g,miles/g,mile/g,
2 --,kpl,kilometer per liter,kilometers per liter,kilometer/liter,kilometers/liter,km per liter,km/liter,kilometer per lit,kilometers per lit,kilometer/lit,kilometers/lit,km per lit,km/lit,k/lit,k/l,klm/liter,klm/lit,klm/l,km/liter,